package models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import play.db.jpa.Model;

@Entity
@Table(name = "Demo_Entries")
public class DemoEntry extends Model {

	public String demo;

	public boolean type; // true means its a success demo and false means its a
	// failure demo
	@ManyToOne
	// @Column(name = "story_id")
	public UserStory userStory;

	/**
	 * constructs a new DemoEntry and associates it to a userStory
	 * 
	 * @param demo
	 * @param type
	 * @param userStory
	 */
	public DemoEntry(String demo, boolean type, UserStory userStory) {
		this.demo = demo;
		this.type = type;
		this.userStory = userStory;
	}
	public DemoEntry(String demo, boolean type){
		this.demo = demo;
		this.type = type;
	}
	public static void editDemoEntry(DemoEntry temp, String demo2, boolean flag) {
		// TODO Auto-generated method stub
		temp.demo = demo2;
		temp.type = flag;
		temp.save();
	}
}
